function Employee(id, importance, subIds) {
    this.id = id;
    this.importance = importance;
    this.subordinates = subIds;
}

const empMap = new Map()

var GetImportance = function(employees, id) {
    for (const e of employees) {
        empMap.set(e.id, e)
    }
    return postOrder(id)
};

const postOrder = function(id) {
    const emp = empMap.get(id)
    let total = 0
    for (const child of emp.subIds) {
        total += postOrder(child)
    }
    return emp.importance + total
}